package com.starpl.mobile.android.monthunsae.november.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import com.starpl.mobile.android.monthunsae.november.R;
import com.starpl.mobile.android.monthunsae.november.handler.MessageHistoryListHandler;
import com.starpl.mobile.android.platform.common.base.BaseActivity;
import com.starpl.mobile.android.platform.component.StarplListView;

/**
 * 쪽지에 대한 히스토리  Activity
 * 
 * @author 우연화
 * @since 2011.03.10
 */
public class MessageHistoryActivity extends BaseActivity implements OnClickListener
{
	private ImageButton mIbRefresh;
	
	private LinearLayout mLlList;
	private MessageHistoryListHandler mMessageHistoryListHandler;
	
	private int mSendUserIdx;
	private String mSendUserName;
	private String mSendUserId;
	
	/* (non-Javadoc)
	 * @see com.starpl.platform.common.base.BaseActivity#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.message_history_activity);
		
		mIbRefresh = (ImageButton)findViewById(R.id.message_history_activity_ib_refresh);
		mLlList = (LinearLayout)findViewById(R.id.message_history_activity_ll_list);
		
		Bundle bundle = getIntent().getExtras();
		mSendUserId = bundle.getString("sendUserId");
		mSendUserIdx = bundle.getInt("sendUserIdx");
		mSendUserName = bundle.getString("sendUserName");
		
		mIbRefresh.setOnClickListener(this);
		
		mMessageHistoryListHandler = new MessageHistoryListHandler(this, mSendUserIdx, mSendUserName, mSendUserId);
		StarplListView listView = new StarplListView(mMessageHistoryListHandler);
		mLlList.addView(listView);		
	}

	@Override
	public void onClick(View v)
	{
		switch(v.getId())
		{
		case R.id.message_history_activity_ib_refresh:
			mMessageHistoryListHandler.refresh();
			break;
		}
	}
}
